#include "secondwidget.h"
#include "ui_secondwidget.h"

SecondWidget::SecondWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SecondWidget)
{
    ui->setupUi(this);
    this->resize(600,800);
    label =  new QLabel(tr("this is Second"),this);
    label->move(300,400);
    firstBtn = new QPushButton(tr("back to first"),this);
    firstBtn ->move(300,500);
    mainBtn = new QPushButton(tr("back to Main"),this);
    mainBtn ->move(300,600);
    connect(firstBtn,&QPushButton::clicked,
            this,&SecondWidget::gotoFirst);
    connect(mainBtn,&QPushButton::clicked,
            this,&SecondWidget::gotoMain);
}

SecondWidget::~SecondWidget()
{
    delete ui;
}

void SecondWidget::gotoFirst()
{
    this->hide();
    emit secondToFirst();
}

void SecondWidget::gotoMain()
{
    this->hide();
    emit secondToMain();
}
